﻿using System;
using System.Reflection;

namespace TC
{
    public class ReflectField : VariableNode
    {
        public Type objType;
        public FieldInfo field;
        
        public ValueInput<object> objIn;
        public ValueOutput<object> valueOut;

        public override void OnCreate()
        {
            base.OnCreate();
            
            objIn = this.AddValueInPort<object>("objIn");
            valueOut = this.AddValueOutPort<object>("valueOut",
                () =>
                {
                    return field.GetValue(objIn.Value);
                });
        }
    }
}
